package com.zxd.iostream;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * ClassName:CopyFile
 * Package:com.zxd.iostream
 *
 * @Date:2023/10/9 21:21
 * @Author:zxde
 */
public class CopyFile {
    public static void main(String[] args){
        FileInputStream fileInputStream =null;
        FileOutputStream fileOutputStream =null;

        try {
             fileInputStream = new FileInputStream("C:/Users/admin/Desktop/系统说明请看一下.txt");
             fileOutputStream = new FileOutputStream("C:/Users/admin/Desktop/new系统说明请看一下.txt");

            byte[] buffer = new byte[1024];
            int len = 0;

            while ((len = fileInputStream.read(buffer)) != -1) {
                fileOutputStream.write(buffer, 0, len);
            }
        }catch (Exception e){
            e.printStackTrace();
        } finally {
            try {
                if(fileInputStream != null) fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                if(fileInputStream != null) fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
